package com.example.demo.controller;


import com.example.demo.entity.UserEntity;
import com.example.demo.result.Result;
import com.example.demo.result.ResultUtil;
import com.example.demo.service.impl.UserServiceImpl;
import org.apache.tomcat.util.buf.UEncoder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.PostConstruct;

@RestController
public class UserController {

    @Autowired
    private UserServiceImpl userService;
    //登录
    @RequestMapping("/login")
    public Result Login(@RequestBody UserEntity userEntity){

        return userService.login(userEntity);
    }
    //注册
    @RequestMapping("/enroll")
    public Result Enroll(@RequestBody UserEntity userEntity){

        return userService.enroll(userEntity);
    }
    //数据上传权限验证
    @RequestMapping("/getUserAuthority")
    public Result getUserAuthority(String username,String password){
        return userService.selectAuthority(username);
    }

}
